

/* change the names for these tables as you see fit.  Names are defined as constants in the PHP web interface code 
The table that contains the blocks is automatcially created by the shapefile import processs (see web interface section of the doc)
*/




/************** table for pending block edits . ********************/

CREATE TABLE [dbo].[king_co_blocks_pending](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[blockId] [int] NULL,
	[userId] [int] NULL,
	[name] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) 


/************** table for random colors to assign to census blocks. ********************/

CREATE TABLE [dbo].[king_co_colors](
	[name] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[color] [varchar](7) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) 



/************** table for user accounts ********************/

CREATE TABLE [dbo].[crtUsers](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[username] [varchar](253) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[password] [varchar](253) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[role] [int] NULL,
	[deleted] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
)

/************** insert a temp admin user ********************/
INSERT INTO crtUsers (username, password, role) VALUES ('username','password',2)


/************** block edit log ********************/

CREATE TABLE [dbo].[crtLog](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[userId] [int] NOT NULL,
	[blockId] [int] NOT NULL,
	[prevNH] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[newNH] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[dateModified] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) 


/************** block export log ********************/
CREATE TABLE [dbo].[exportLog](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[dateRun] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]



